All Objects
Event Object
frame
Window
OBJECT: Document
The
Document
object provides access to the elements in an HTML page from within your script. This includes the properties of every form, link and anchor (and, where applicable, any sub-elements), as well as global
Document
properties such as background and foreground colors.
PROPERTIES
alinkColor
Property
This property defines the color of an active link. The
"colorinfo"
argument is a string that can contain either the hexadecimal definition of the color or it's literal description.
Syntax:
document.
alinkColor
= "colorinfo"
anchors
Property
This property is an array containing references to all the named
Anchor
objects in the current document.
Syntax:
document.
anchors
["anchorID"]
applets
Property
This property is an array containing references to all the
Applet
objects in the current document.
Syntax:
document.
applets
["appletID"]
bgColor
Property
This property defines a document's background color. The
"colorinfo"
argument is a string that can contain either the hexadecimal definition of the color or it's literal description.
Syntax:
document.
bgColor
= "colorinfo"
cookie
Property
This property is a string that returns a report detailing all visible and un-expired cookies that are associated with the specified document.
Syntax:
document.
cookie
[ = "expression(s)"]
domain
Property
This property sets or returns the domain name of the server from which the document originated.
Syntax:
document.
domain
= "domaininfo"
embeds
Property
This property is an array containing references to all the embedded objects in the current document.
Syntax:
document.
embeds
["embed_objID"]
fgColor
Property
This property defines a document's foreground (text) color. The
"colorinfo"
argument is a string that can contain either the hexadecimal definition of the color or it's literal description.
Syntax:
document.
fgColor
= "colorinfo"
formName Property
Every form in a document has a separate
document
object property, the name of which is taken from the value asigned to the form with the <FORM NAME = "formID"> tag. Any form in the document can then be referred to with the syntax below.
Syntax:
document.
"formname"
forms
Property
This property is an array containing references to all the
Form
objects in the current document.
Syntax:
document.
forms
["formID"]
images
Property
This property is an array containing references to all the
Image
objects in the current document.
Syntax:
document.
images
["imageID"]
lastModified
Property
This property returns the date that the document was last modified.
Syntax:
document.
lastModified
layers
Property
This property is an array containing references to all the
Layer
objects in the current document.
Syntax:
document.
layers
["layerID"]
linkColor
Property
This property defines the color of any hyperlinks in the document. The
"colorinfo"
argument is a string that can contain either the hexadecimal definition of the color or it's literal description.
Syntax:
document.
linkColor
= "colorinfo"
links
Property
This property is an array containing references to all the
Area
and
Link
objects in the current document.
Syntax:
document.
links
["linkID"]
plugins
Property
This property is an array containing references to all the
Plugin
objects in the current document.
Syntax:
document.
plugins
["pluginID"]
referrer Property
If a destination document is reached by a user clicking on a
Link
object in another document (the referrer), this property returns the referring document's URL.
Syntax:
document.
referrer
title Property
This property returns the document's name as defined between the <TITLE></TITLE> tags.
Syntax:
document.
title
URL Property
This property is used to retrieve the document's full URL.
Syntax:
document.
URL
vlinkColor
Property
This property defines the color of any visited links in the document. The
"colorinfo"
argument is a string that can contain either the hexadecimal definition of the color or it's literal description.
Syntax:
document.
vlinkColor
= "colorinfo"
METHODS
captureEvents Method
This method instructs the document to capture and handle all events of a particular type. See the
event
object for a list of event types.
Syntax:
document.
captureEvents
(eventType)
close
Method
This method closes an output stream previously opened with the
document.open
method and forces data collected from any instances of the
document.write
or
document.writeln
methods to be displayed.
Syntax:
document.
close( )
getSelection
Method
This method can be used to return the contents of selected text in the current document.
Syntax:
document.
getSelection( )
handleEvent Method
This method calls the handler for the specified event.
Syntax:
document.
handleEvent
(event)
open
Method
This method is used to open a stream to collect the output from any
write
or
writeln
methods.
Syntax:
document.
open
([mimeType[, replace]])
releaseEvents Method
This method is used to set the document to release any events of the type
eventType
and passes them along to objects further down the event heirarchy.
Syntax:
document.
releaseEvents
(eventType)
routeEvent Method
This method is used to send the event specified along the normal event hierarchy.
Syntax:
document.
routeEvent
(event)
write
Method
This method is used to write HTML expressions to the specified document.
Syntax:
document.
write
("expression(s)")
writeln Method
This method is identical to the
write
method detailed above, with the addition of writing a new line character after any specified expressions.
Syntax:
document.
writeln
("expression(s)")
EVENT HANDLERS
onClick
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
Click
event (when an element is clicked).
Syntax:
document.
onClick
="myJavaScriptCode"
onDblClick
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
DblClick
event (when an element is double-clicked).
Syntax:
document.
onDblClick
="myJavaScriptCode"
onKeyDown
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
KeyDown
event (when a key is depressed).
Syntax:
document.
onKeyDown
="myJavaScriptCode"
onKeyPress
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
KeyPress
event (when a key is depressed and held down).
Syntax:
document.
onKeyPress
="myJavaScriptCode"
onKeyUp
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
KeyUp
event (when a key is released).
Syntax:
document.
onKeyUp
="myJavaScriptCode"
onMouseDown
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
MouseDown
event (when a mouse button is depressed).
Syntax:
document.
onMouseDown
="myJavaScriptCode"
onMouseUp
Event handler
This event handler executes some specified JavaScript code on the occurrence of a
MouseUp
event (when a mouse button is released).
Syntax:
document.
onMouseUp
="myJavaScriptCode"
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information